{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
	{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
		{{#if permissions.documentEdit}}
			{{#ui/ui-toolbar-dropdown label="Actions" arrow=true}}
				{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
					<ul class="menu">
						<li class="item" {{action "onShowRequestContributionModal"}}>Request contribution</li>
						<li class="item" {{action "onShowRequestFeedbackModal"}}>Request feedback</li>
						<li class="item" {{action "onShowRequestReadModal"}}>Request read</li>
						{{#if (eq document.lifecycle constants.Lifecycle.Draft)}}
							<li class="divider"/>
							<li class="item" {{action "onShowPublishModal"}}>Request publication</li>
						{{/if}}
						<li class="divider"/>
						<li class="item" {{action "onShareModal"}}>Share via secure external link</li>
					</ul>
				{{/attach-popover}}
			{{/ui/ui-toolbar-dropdown}}
		{{/if}}
	{{/if}}

	{{#ui/ui-toolbar-dropdown label="Content" arrow=true}}
		{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
			<ul class="menu">
				{{#if pinState.isPinned}}
					<li class="item" {{action "onUnpin"}}>Remove bookmark</li>
					<li class="divider"/>
				{{else if session.authenticated}}
					<li class="item" {{action "onPin"}}>Bookmark</li>
					<li class="divider"/>
				{{/if}}
				<li class="item" {{action "onShowPrintModal"}}>Print</li>
				<li class="item" {{action "onExport"}}>Download</li>
				{{#if (or permissions.documentAdd permissions.documentCopy)}}
					<li class="divider"/>
					{{#if permissions.documentAdd}}
						<li class="item" {{action "onShowTemplateModal"}}>Template</li>
					{{/if}}
					{{#if permissions.documentCopy}}
						<li class="item" {{action "onShowDuplicateModal"}}>Copy</li>
					{{/if}}
				{{/if}}
				{{#if permissions.documentDelete}}
					<li class="divider"/>
					<li class="item red" {{action "onShowDeleteModal"}}>Delete</li>
				{{/if}}
			</ul>
		{{/attach-popover}}
	{{/ui/ui-toolbar-dropdown}}

	{{#if (or showActivity showRevisions)}}
		{{#ui/ui-toolbar-dropdown label="History" arrow=true}}
			{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
				<ul class="menu">
					{{#if showActivity}}
						{{#link-to "document.activity" class="item"}}Activity{{/link-to}}
					{{/if}}
					{{#if showRevisions}}
						{{#link-to "document.revisions" class="item"}}Revisions{{/link-to}}
					{{/if}}
				</ul>
			{{/attach-popover}}
		{{/ui/ui-toolbar-dropdown}}
	{{/if}}

	{{#if permissions.documentEdit}}
		{{ui/ui-toolbar-icon icon=constants.Icon.Settings color=constants.Color.Green tooltip="Rename, Categories, Tag, Status, Workflow" linkTo="document.settings"}}
	{{/if}}
{{/ui/ui-toolbar}}

<div id="document-template-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">Save as Template</div>
			<div class="modal-body">
				<form onsubmit={{action "onSaveTemplate"}}>
					<div class="form-group">
						<label for="new-template-name">Name</label>
						{{input id="new-template-name" value=saveTemplate.name type="email" class="form-control mousetrap" placeholder="Template name"}}
						<small class="form-text text-muted">Good template name conveys document type</small>
					</div>
					<div class="form-group">
						<label for="new-template-desc">Description</label>
						{{textarea id="new-template-desc" value=saveTemplate.description class="form-control" rows="5"}}
						<small class="form-text text-muted">Explain use case for this template</small>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=constants.Label.Cancel dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.Save onClick=(action "onSaveTemplate")}}
			</div>
		</div>
	</div>
</div>

<div id="document-print-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">Print</div>
			<div class="modal-body">
				<p>Print all content or select sections.</p>
				{{#each pages as |item|}}
					{{#ui/ui-checkbox selected=item.printSelected}}
						{{item.page.numbering}}. {{item.page.title}}
					{{/ui/ui-checkbox}}
				{{/each}}
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=constants.Label.Cancel dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.Print onClick=(action "onPrintSelection")}}
			</div>
		</div>
	</div>
</div>

<div id="document-delete-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">Delete Document</div>
			<div class="modal-body">
				<p>Are you sure you want to delete this document?</p>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=constants.Label.Cancel dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Red light=true label=constants.Label.Delete onClick=(action "onDocumentDelete")}}
			</div>
		</div>
	</div>
</div>

<div id="document-duplicate-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">Duplicate</div>
			<div class="modal-body">
				<form onsubmit={{action "onDuplicate"}}>
					<div class="form-group">
						<label for="duplicate-name">Name</label>
						{{input id="duplicate-name" value=duplicateName type="email" class="form-control mousetrap" placeholder="Name"}}
						<small class="form-text text-muted">Content will be duplicated within this space</small>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=constants.Label.Cancel dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.Duplicate onClick=(action "onDuplicate")}}
			</div>
		</div>
	</div>
</div>
